package pkg

import (
	"chat3/appconfig"
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

type Data struct {
	conclusionType int64
}

func Sensitive(content string) bool {
	a := appconfig.AppCon.Sensitive
	client := censor.NewClient(a.Ak, a.Sk)
	//如果是百度云ak sk,使用下面的客户端
	res := client.TextCensor(content)
	fmt.Println(res)
	var data Data
	json.Unmarshal([]byte(res), &data)
	if data.conclusionType == 1 {
		return true
	}

	return false
}
